]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Filter apps in default folder
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 7 Feb 2025 14:54:15 +0000 (15:54 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 13 Feb 2025 19:59:17 +0000 (19:59 +0000)
We currently create the default folder with the corresponding
app list, regardless of whether the apps are actually part of
the default install or not.

This matters when a user explicitly install such an app later,
as it will be hidden away in the folder rather than appended
to the app grid as expected.

To avoid that, only add currently-installed apps to the folder
when creating it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3632>

js/ui/appDisplay.js

index 9801b71340552b277928ac3266a98c857fa630cd..b08d9af5d823634a64f4ccb6a86ffcc48eed1868 100644 (file)
@@ -1418,12 +1418,16 @@ class AppDisplay extends BaseAppView {
         if (this._folderSettings.get_strv('folder-children').length > 0)
             return;
 
+        const appSys = Shell.AppSystem.get_default();
         const folders = Object.keys(DEFAULT_FOLDERS);
         this._folderSettings.set_strv('folder-children', folders);
 
         const {path} = this._folderSettings;
         for (const folder of folders) {
             const {name, categories, apps} = DEFAULT_FOLDERS[folder];
+            const filteredApps = apps
+                ? apps.filter(id => appSys.lookup_app(id) != null)
+                : [];
             const child = new Gio.Settings({
                 schema_id: 'org.gnome.desktop.app-folders.folder',
                 path: `${path}folders/${folder}/`,
@@ -1432,8 +1436,8 @@ class AppDisplay extends BaseAppView {
             child.set_boolean('translate', true);
             if (categories)
                 child.set_strv('categories', categories);
-            if (apps)
-                child.set_strv('apps', apps);
+            if (filteredApps.length > 0)
+                child.set_strv('apps', filteredApps);
         }
     }